package com.dingjian.broker.enums;

public enum IntentionStatusEnum {
	ONGOING("ONGOING","意向中"), //意向中
	FINISHED("FINISHED","已成交"), //已成交
	AUTOABORT("AUTOABORT","系统转公"), //自动终止
	MANUALABORT("MANUALABORT","主动转公"); //人工终止
	
	private IntentionStatusEnum(){}
	private IntentionStatusEnum(String key,String description){
		this.key=key;
		this.description=description;
	}
	private String key;
	
	private String description;

	public String getKey() {
		return key;
	}
	public void setKey(String key) {
		this.key = key;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	
	/**
	 * 取枚举的json字符串
	 * @return
	 */
	public static String getJsonStr(){
		IntentionStatusEnum[] enums = IntentionStatusEnum.values();
		StringBuffer jsonStr = new StringBuffer("[");
		for (IntentionStatusEnum senum : enums) {
			if(!"[".equals(jsonStr.toString())){
				jsonStr.append(",");
			}
			jsonStr.append("{id:'")
					.append(senum)
					.append("',name:'")
					.append(senum.getDescription())
					.append("',value:'")
					.append(senum)
					.append("'}");
		}
		jsonStr.append("]");
		return jsonStr.toString();
	}
}
